//
// impressionistUI.h
//
// The header file for the UI part
//

#ifndef ImpressionistUI_h
#define ImpressionistUI_h

#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/fl_file_chooser.H>		// FLTK file chooser
#include <FL/Fl_Menu_Bar.H>
#include <FL/Fl_Value_Slider.H>
#include <FL/Fl_Choice.H>
#include <FL/Fl_Button.H>
#include <FL/Fl_Light_Button.H>
#include <FL/FL_Scroll.H>
#include <FL/Fl_Multiline_Output.H>
#include <FL/Fl_Input.H>
#include <FL/Fl_Box.H>

#include "Impressionist.h"
#include "OriginalView.h"

#define WINDOW_WIDTH 1400
#define WINDOW_HEIGHT 950
#define VIEW_WIDTH WINDOW_WIDTH
#define VIEW_HEIGHT WINDOW_HEIGHT-25

class ImpressionistUI {
public:
	ImpressionistUI();

	// The FLTK widgets
	Fl_Window*			m_mainWindow;
	Fl_Menu_Bar*		m_menubar;
	Fl_Scroll*			m_scroll;
	Fl_Button*          m_ClearCanvasButton;
	Fl_Group*			m_panel;
	// Parallel lines
	Fl_Button*			m_setX;		
	Fl_Button*			m_setY;
	Fl_Button*			m_setZ;
	Fl_Button*			m_changePL;
	Fl_Button*			m_resetPL;
	// Reference Plane
	Fl_Button*			m_rpStart;
	Fl_Button*			m_rpReset;
	Fl_Button*			m_rpMove;
	Fl_Box*				m_rp1;
	Fl_Box*				m_rp2;
	Fl_Box*				m_rp3;
	Fl_Box*				m_rp4;
	Fl_Box*				m_rp5;
	Fl_Input*		m_rp1input;
	Fl_Input*		m_rp2input;
	Fl_Input*		m_rp3input;
	Fl_Input*		m_rp4input;
	Fl_Input*		m_rp5input;
	// Vertical Lines
	Fl_Button*			m_vStart;
	Fl_Button*			m_vReset;
	Fl_Button*			m_vMove;
	Fl_Button*			m_vCal;
	OriginalView* m_origView;   //customized fl_gl_window

	// Member functions
	void				setDocument(Impressionist* doc);
	Impressionist*	    getDocument();

	void				show();
	void				resize_windows(int w, int h);

	void				updateLabel(int id,int color);
	// Interface to get attribute

	//int					getSize();
	//void				setSize(int size);

private:
	Impressionist*	m_pDoc;		// pointer to document to communicate with the document

	// All attributes here
	int		m_nSize;

	// Static class members
	static Fl_Menu_Item		menuitems[];
	//static Fl_Menu_Item		brushTypeMenu[NUM_BRUSH_TYPE+1];

	static ImpressionistUI*	whoami(Fl_Menu_* o);
	static ImpressionistUI* whoami(Fl_Widget* o);

	// All callbacks here.  Callbacks are declared 
	// static
	static void	cb_load_image(Fl_Menu_* o, void* v);
	static void	cb_exit(Fl_Menu_* o, void* v);
	static void	cb_about(Fl_Menu_* o, void* v);
	// these are for buttons
	static void cb_setX(Fl_Widget*,void*);
	static void cb_setY(Fl_Widget*,void*);
	static void cb_setZ(Fl_Widget*,void*);
	static void cb_changePL(Fl_Widget*,void*);
	static void cb_resetPL(Fl_Widget*,void*);
	static void cb_rpStart(Fl_Widget*,void*);
	static void cb_rpMove(Fl_Widget*,void*);
	static void cb_rpReset(Fl_Widget*,void*);
	static void cb_vStart(Fl_Widget*,void*);
	static void cb_vMove(Fl_Widget*,void*);
	static void cb_vReset(Fl_Widget*,void*);
	static void cb_vCal(Fl_Widget*,void*);
	// for inputs
	static void cb_m_rp1input(Fl_Widget* o,void* userdata);
	static void cb_m_rp2input(Fl_Widget* o,void* userdata);
	static void cb_m_rp3input(Fl_Widget* o,void* userdata);
	static void cb_m_rp4input(Fl_Widget* o,void* userdata);
	static void cb_m_rp5input(Fl_Widget* o,void* userdata);
};

#endif
